#pragma once

#include <QLineEdit>

#include "widgets.h"

class S_WIDGETS_EXPORT SLineEdit : public QLineEdit {
  Q_OBJECT
 public:
  SLineEdit(const QString&, QWidget* parent = nullptr);
  ~SLineEdit() = default;

  bool selectAllWhenFocus() const { return m_selectAllWhenFocus; }
  void setSelectAllWhenFocus(bool val) { m_selectAllWhenFocus = val; }

 signals:
  void clicked();

 protected:
  virtual void focusInEvent(QFocusEvent*) override;
  virtual void mousePressEvent(QMouseEvent*) override;

 private:
  bool m_selectAllWhenFocus = false;
};